﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WP7.LockerPlayer.ViewModels
{
    public class ArtistViewModel
    {
        public string ArtistId { get; set; }
        public string ArtistName { get; set; }
        public string ArtistSize { get; set; }
        public int? AlbumCount { get; set; }
        public int? TrackCount { get; set; }

        private string _fakeString;
        public string AlbumCountMessage
        {
            get
            {
                if( this.AlbumCount.HasValue)
                    return this.AlbumCount > 1 ? String.Format("{0} Albums", this.AlbumCount.Value) : String.Format("{0} Album", this.AlbumCount.Value);
                return "0 Albums";
            }
            set
            {
                this._fakeString = value;
            }
        }

        public ArtistViewModel()
        {

        }
        public static int CompareByName(object obj1, object obj2)
        {
            ArtistViewModel p1 = (ArtistViewModel)obj1;
            ArtistViewModel p2 = (ArtistViewModel)obj2;

            int result = p1.ArtistName.CompareTo(p2.ArtistName);

            return result;
        }
        public static string GetFirstNameKey(ArtistViewModel artist)
        {
            char key = char.ToLower(artist.ArtistName[0]);

            if (key < 'a' || key > 'z')
            {
                key = '#';
            }

            return key.ToString();
        }
    }
}
